home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Examples / 3DWidgets / Slider.wwModel / model.eve
Encoding:
Text File  |  1995-04-10  |  1.6 KB  |  47 lines

  1. set u .5
  2. set min 0
  3. set max 1
  4. set width 1
  5. set height .25
  6. set fontName Helvetica
  7. set fontSize 20
  8. set sliderColor {1.0 0.0 0.0}
  9.  
  10. defineClass: slider {current min max width height fontName fontSize sliderColor} {
  11.  
  12.   AttributeBegin
  13.     Attribute identifier name sliderAtValue${current}
  14.     Sides 2
  15.     AttributeBegin
  16.       Attribute identifier name min
  17.       # need to go up and and in
  18.       Patch bilinear P "0 0 [expr {-.75 * $height}] 0 [expr {-1 * $height}] [expr {-.75 * $height}]  \
  19.                         0 0 [expr {.75 * $height}] 0 [expr {-1 * $height}] [expr {.75 * $height}]"
  20.       Translate 0 [expr {.5 * $height}] 0
  21.       WW3DText $fontName $fontSize [format %g $min] center
  22.     AttributeEnd
  23.  
  24.     AttributeBegin
  25.       Attribute identifier name max
  26.       Translate $width 0 0 
  27.       Patch bilinear P "0 0 [expr {-.75 * $height}] 0 [expr {-1 * $height}] [expr {-.75 * $height}]  \
  28.                         0 0 [expr {.75 * $height}] 0 [expr {-1 * $height}] [expr {.75 * $height}]"
  29.       Translate 0 [expr {.5 * $height}] 0
  30.       WW3DText $fontName $fontSize [format %g $max] center
  31.     AttributeEnd
  32.  
  33.     AttributeBegin
  34.       Attribute identifier name slider
  35.       Color $sliderColor
  36.       Patch bilinear P "0 0 0   0 [expr {-1 * $height}] 0   \
  37.                         [expr {($current/($max-$min)) * $width}] 0 0   [expr {($current/($max-$min)) * $width}]  [expr {-1 * $height}] 0"  
  38.     AttributeEnd
  39.   AttributeEnd
  40. }
  41.  
  42. loadControlPanel controls.nib
  43.  
  44. startShape aSlider
  45.   animatable: {slider [expr {$u * ($max - $min)}] $min $max $width $height $fontName $fontSize $sliderColor}
  46. endShape
  47.